package com.htl.exampro.user.api;

import com.htl.exampro.base.model.PageResult;
import com.htl.exampro.base.model.ServerResponse;
import com.htl.exampro.user.pojo.query.UserPageParam;
import com.htl.exampro.user.pojo.vo.PasswordVO;
import com.htl.exampro.user.pojo.vo.UserVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户管理接口
 */
@FeignClient(value = "exam-pro-user", contextId = "UserApi", path = "/user/user")
public interface UserApi {
    @PostMapping("/page")
    ServerResponse<PageResult<UserVO>> getUserList(@RequestBody UserPageParam pageParam);

    @PostMapping("register")
    ServerResponse<Void> register(@RequestBody UserVO user);

    @PostMapping("/getUsernameList")
    ServerResponse<List<UserVO>> getUsernameList(@RequestBody List<String> userIdList);

    @GetMapping("/{id}")
    ServerResponse<UserVO> getUserDetail(@PathVariable("id") Long id);

    @PutMapping("")
    ServerResponse<Void> updateUser(@RequestBody UserVO user);

    @PutMapping("/status")
    ServerResponse<Void> updateUserStatus(@RequestBody UserVO user);

    @DeleteMapping("/{id}")
    ServerResponse<Void> deleteUser(@PathVariable("id") Long id);

    @PostMapping("/login")
    ServerResponse<String> login(@RequestBody UserVO user);

    @GetMapping("/logout")
    ServerResponse<Void> logout();

    @GetMapping("/current")
    ServerResponse<UserVO> getCurrentUser();

    @PostMapping("/current")
    ServerResponse<Void> updateCurrentUser(@RequestBody UserVO user);

    @PutMapping("/password")
    ServerResponse<Void> changePassword(@Validated @RequestBody PasswordVO passwordVO);

    @PutMapping("/{id}/password/reset")
    ServerResponse<Void> resetPassword(@PathVariable("id") String id, @RequestBody PasswordVO passwordVO);
}